#pragma once

#include "Shapes2D/Point2D.h"
#include "Shapes3D/Point3D.h"
#include "Shapes3D/Direction3D.h"
#include <vector>

#define DEG2RAD(deg) deg*0.0174532925
#define RAD2DEG(rad) rad*57.2957795

#define C_BLACK			0x000000
#define C_WHITE			0xFFFFFF
#define C_RED			0xFF0000
#define C_GREEN			0x00FF00
#define C_BLUE			0x0000FF
#define C_CYAN			0x00FFFF
#define C_DARK_BLUE		0x0000A0
#define C_LIGHT_PURPLE	0xFF0080
#define C_PURPLE		0x800080
#define C_YELLOW		0xFFFF00
#define C_FUCHSIA		0xFF00FF
#define C_SILVER		0xC0C0C0
#define C_GRAY			0x808080
#define C_GREY			C_GRAY
#define C_ORANGE		0xFFA500
#define C_BROWN			0xA52A2A
#define C_MAROON		0x800000
#define C_GREEN2		0x008000
#define C_OLIVE			0x808000

#define KEY_F1 1
#define KEY_F2 2
#define KEY_F3 3
#define KEY_F4 4
#define KEY_F5 5
#define KEY_F6 6
#define KEY_F7 7
#define KEY_DELETE 8
#define KEY_TAB 9
#define KEY_F8 10
#define KEY_F9 11
#define KEY_F10 12
#define KEY_ENTER 13
#define KEY_F11 14
#define KEY_F12 15
#define KEY_LEFT 16
#define KEY_RIGHT 17
#define KEY_UP 18
#define KEY_DOWN 19
#define KEY_PAGE_UP 20
#define KEY_PAGE_DOWN 21
#define KEY_HOME 22
#define KEY_END 23
#define KEY_INSERT 24
#define KEY_SHIFT_TAB 25
#define KEY_BACKSPACE 127
#define KEY_SPACE 32

class GameLib
{
private:
	struct Sclr{float c[4];};
	std::vector<Sclr> colorPushPop;
public:
    void setColor(int hexColor);
    void setColorA(float *colors);
    void getColorA(float *colors);//array of 4
    void setLineWidth(double width);
    double getLineWidth();
    void setPointSize(double size);
    long mapL(long x, long in_min, long in_max, long out_min, long out_max);
    int mapI(int x, int in_min, int in_max, int out_min, int out_max);
    float mapF(float x, float in_min, float in_max, float out_min, float out_max);
    double mapD(double x, double in_min, double in_max, double out_min, double out_max);
    void screenToGL(Point2D &screen, Point3D &toGL);
    void setShine(double amount);
    void calculateNormalTriangle(Point3D &va,Point3D &vb,Point3D &vc,Direction3D &normal);
	void calculateNormalPlane(Point3D &va, Point3D &vb, Point3D &vc, Point3D &vd, Direction3D &normal);
    void setNormal(Direction3D normal);
	void errListener(const char *whosFault);
	void pushColor();
	void popColor();
};

extern GameLib gameLib;